package com.rickpan.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 文件夹树节点响应DTO
 *
 * @author RickPan Team
 * @since 2025-07-02
 */
public class FolderTreeNodeResponse {

    private Long id;
    private String name;
    private Long parentId;
    private Integer fileCount;
    private Boolean hasChildren;
    private List<FolderTreeNodeResponse> children;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    /**
     * 构造方法 - 基础信息
     */
    public FolderTreeNodeResponse(Long id, String name, Long parentId, Integer fileCount, Boolean hasChildren) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.fileCount = fileCount != null ? fileCount : 0;
        this.hasChildren = hasChildren != null ? hasChildren : false;
    }

    /**
     * 构造方法 - 完整信息
     */
    public FolderTreeNodeResponse(Long id, String name, Long parentId, Integer fileCount,
                                Boolean hasChildren, LocalDateTime createdAt, LocalDateTime updatedAt) {
        this(id, name, parentId, fileCount, hasChildren);
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
    }

    /**
     * 默认构造方法
     */
    public FolderTreeNodeResponse() {
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Integer getFileCount() {
        return fileCount;
    }

    public void setFileCount(Integer fileCount) {
        this.fileCount = fileCount;
    }

    public Boolean getHasChildren() {
        return hasChildren;
    }

    public void setHasChildren(Boolean hasChildren) {
        this.hasChildren = hasChildren;
    }

    public List<FolderTreeNodeResponse> getChildren() {
        return children;
    }

    public void setChildren(List<FolderTreeNodeResponse> children) {
        this.children = children;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
}
